function [v phi] = estimate(quant_centers, v_prev, phi_prev, survey)
global g_quants;
global g_period;
global g_quant_num;

w = zeros(g_quant_num, survey);
w(:, 1) = weights(quant_centers, v_prev, phi_prev, 1) .* g_quants(1, :)';
for i = 2:survey
    w(:, i) = weights(quant_centers, v_prev, phi_prev, i) ... 
         .* g_quants(i, :)';
end

debug_disp(2, w);

% Расчет скорости
k_1 = 0:survey-1;
sum1 = sum(abs(quant_centers(:, ones(1, survey))) ...
    .* w .* k_1(ones(1, g_quant_num), :));
sum2 = sum((k_1(ones(1, g_quant_num), :)).^2 .* w);

v = sum(sum1) / sum(sum2) / g_period;

% Расчет фазы
sum1 = sum(angle(quant_centers(:, ones(1, survey))) .* w);
sum2 = sum(w);

phi = sum(sum1) / sum(sum2);

end